<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>FSP联飞活动公告</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100vh;
            margin: 0;
            background-color: #f0f0f0;
        }
        #header {
            font-size: 24px;
            font-weight: bold;
            margin-bottom: 20px;
        }
        #loginBox, #mainContent {
            text-align: center;
            display: none;
        }
        #loginBox input {
            margin: 10px;
            padding: 10px;
            font-size: 16px;
        }
        #loginButton {
            padding: 10px 20px;
            font-size: 16px;
            cursor: pointer;
        }
        #textBox {
            width: 300px;
            height: 100px;
            margin-bottom: 10px;
            padding: 10px;
            font-size: 16px;
        }
        #sendButton {
            padding: 10px 20px;
            font-size: 16px;
            cursor: pointer;
        }
        #displayBox {
            margin-top: 20px;
            width: 300px;
            height: 100px;
            border: 1px solid #ccc;
            padding: 10px;
            background-color: #fff;
            overflow-y: auto;
        }
        #footer {
            margin-top: 20px;
            font-size: 14px;
            color: #666;
        }
    </style>
</head>
<body>
    <div id="loginBox">
        <h1>用户登录</h1>
        <input type="text" id="loginCode" placeholder="输入编码" />
        <button id="loginButton">登录</button>
    </div>

    <div id="mainContent">
        <div id="header">FSP联飞平台活动公告</div>
        <textarea id="textBox" placeholder="输入文本..."></textarea><br>
        <button id="sendButton">发送</button>
        <div id="displayBox"></div>
    </div>

    <div id="footer">联飞活动由：由3762与8868编制</div>

    <script>
        const loginBox = document.getElementById('loginBox');
        const mainContent = document.getElementById('mainContent');
        const loginCode = document.getElementById('loginCode');
        const loginButton = document.getElementById('loginButton');
        const textBox = document.getElementById('textBox');
        const sendButton = document.getElementById('sendButton');
        const displayBox = document.getElementById('displayBox');

        window.onload = () => {
            // 显示登录界面
            loginBox.style.display = 'block';
            mainContent.style.display = 'none';
        };

        loginButton.addEventListener('click', () => {
            const code = loginCode.value;
            if (code === '1111') {
                // 登录成功后，显示主内容并隐藏发送按钮和文本框
                loginBox.style.display = 'none';
                mainContent.style.display = 'block';
                sendButton.style.display = 'none';
                textBox.style.display = 'none';

                // 从本地存储读取并显示内容
                const savedContent = localStorage.getItem('savedContent');
                if (savedContent) {
                    displayBox.innerHTML = savedContent;
                }
            } else if (code === '3628') {
                // 登录成功后，显示主内容并保留发送按钮
                loginBox.style.display = 'none';
                mainContent.style.display = 'block';

                // 从本地存储读取并显示内容
                const savedContent = localStorage.getItem('savedContent');
                if (savedContent) {
                    displayBox.innerHTML = savedContent;
                }
            } else {
                alert('编码错误，请重新输入');
            }
        });

        // 发送按钮点击事件
        sendButton.addEventListener('click', () => {
            const content = textBox.value;
            displayBox.innerHTML = content;

            // 将内容保存到本地存储
            localStorage.setItem('savedContent', content);

            // 清空文本框
            textBox.value = '';
        });
    </script>
</body>
</html>